package com.he.hsdyc;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @Author :
 * @Description :
 * @Modified By : WT
 */
@Configuration
@EnableSwagger2
public class Swagger2 {                                       //swagger页面bug,接口点不开，解决：点击右上角的Expand Operations即可

    @Bean
    public Docket config() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .useDefaultResponseMessages(false)
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.he.hsdyc.controller"))
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("taoCloud--API文档")
                .contact(new Contact("tly", "", "182****9009"))//http://localhost:9002/swagger-ui.html
                .build();
    }
}